<?php

include_once('constants.php');

# -=-=-=- PHP FORM VARIABLES (add as many as you would like)

function mailRegisterConfirm($username, $name, $email, $tid)
{
    include('constants.php');
    # -=-=-=- MIME BOUNDARY
    
    $mime_boundary = "----$product_name----".md5(time());
    
    # -=-=-=- MAIL HEADERS
    
    $to = "$email";
    $subject = "Activate your account with $product_name";
    
    $headers = "From: $product_name <$product_supportEmail>\n";
    $headers .= "Reply-To: $product_name <$product_supportEmail>\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
    
    # -=-=-=- TEXT EMAIL PART
    
    $message = "--$mime_boundary\n";
    $message .= "Content-Type: text/plain; charset=UTF-8\n";
    $message .= "Content-Transfer-Encoding: 8bit\n\n";
    
    $message .= "Dear $name,\n\n";
    $message .= "You or someone else have recently registered an account on $product_name using this email address. ";
    $message .= "In order to activate your account, please click on the following link:\n";
    $message .= "http:\\\\$product_site\\activate.php?actusername=$username&acttid=$tid\n";
    $message .= "Please keep the following login information secure, you will need to enter it in the $product_name ";
    $message .= "application on your mobile phone in order to activate tracking:\n\n";
    $message .= "Username: $username \n";
    $message .= "Activation ID: $tid \n\n";
    $message .= "Thank You,\n\n";
    $message .= "$product_name Team\n\n";
    $message .= "$product_supportEmail\n\n";
    
    # -=-=-=- HTML EMAIL PART
     
    $message .= "--$mime_boundary\n";
    $message .= "Content-Type: text/html; charset=UTF-8\n";
    $message .= "Content-Transfer-Encoding: 8bit\n\n";
    
    $message .= "<html>\n";
    $message .= "<body style=\"font-family:Verdana, Verdana, Geneva, sans-serif; font-size:14px; color:#666666;\">\n";
    $message .= "Dear $name,<br>\n";
    $message .= "<br>\n";
    $message .= "You or someone else have recently registered an account on $product_name using this email address.<br>\n";
    $message .= "In order to activate your account, please click on the following link:<br>\n<br>\n";
    $message .= "<a href='http://$product_site/activate.php?actusername=$username&acttid=$tid'>http:\\\\$product_site\\activate.php?actusername=$username&acttid=$tid</a><br>\n<br>\n";
    $message .= "Please keep the following login information secure, you will need to enter it in the $product_name ";
    $message .= "application on your mobile phone in order to activate tracking:<br><br>";
    $message .= "Username: $username <br>\n";
    $message .= "Activation ID: $tid <br>\n<br>\n";
    $message .= "<br>\n";
    $message .= "Thank you,<br>\n";
    $message .= "$product_name Team<br>\n";
    $message .= "$product_supportEmail<br>\n";
    $message .= "</body>\n";
    $message .= "</html>\n";
    
    # -=-=-=- FINAL BOUNDARY
    
    $message .= "--$mime_boundary--\n\n";
    
    # -=-=-=- SEND MAIL
    
    $mail_sent = @mail( $to, $subject, $message, $headers );
}

function mailLostPassword($username, $name, $email, $password)
{
    include('constants.php');
    # -=-=-=- MIME BOUNDARY
    
    $mime_boundary = "----$product_name----".md5(time());
    
    # -=-=-=- MAIL HEADERS
    
    $to = "$email";
    $subject = "$product_name - Lost Password ";
    
    $headers = "From: $product_name <$product_supportEmail>\n";
    $headers .= "Reply-To: $product_name <$product_supportEmail>\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
    
    # -=-=-=- TEXT EMAIL PART
    
    $message = "--$mime_boundary\n";
    $message .= "Content-Type: text/plain; charset=UTF-8\n";
    $message .= "Content-Transfer-Encoding: 8bit\n\n";
    
    $message .= "Dear $name:\n\n";
    $message .= "You or someone else have recently registered a lost password on your $product_name account";
    $message .= "We reset your password to a new one:\n\n";
    $message .= "Password: $password \n";
    $message .= "Thank You,\n\n";
    $message .= "$product_name Team\n\n";
    $message .= "$product_supportEmail\n\n";
    
    # -=-=-=- HTML EMAIL PART
     
    $message .= "--$mime_boundary\n";
    $message .= "Content-Type: text/html; charset=UTF-8\n";
    $message .= "Content-Transfer-Encoding: 8bit\n\n";
    
    $message .= "<html>\n";
    $message .= "<body style=\"font-family:Verdana, Verdana, Geneva, sans-serif; font-size:14px; color:#666666;\">\n";
    $message .= "Dear $name:<br>\n";
    $message .= "<br>\n";
    $message .= "You or someone else have recently registered a lost password on your $product_name account<br>\n";
    $message .= "We reset your password to a new one:<br>\n<br>\n";
    $message .= "Password: $password <br>\n";
    $message .= "<br>\n";
    $message .= "Thank you,<br>\n";
    $message .= "$product_name Team<br>\n";
    $message .= "$product_supportEmail<br>\n";
    $message .= "</body>\n";
    $message .= "</html>\n";
    
    # -=-=-=- FINAL BOUNDARY
    
    $message .= "--$mime_boundary--\n\n";
    
    # -=-=-=- SEND MAIL
    
    $mail_sent = @mail( $to, $subject, $message, $headers );
}

function mailInvite($name, $otherName, $otherEmail)
{
    include('constants.php');
    # -=-=-=- MIME BOUNDARY
    
    $mime_boundary = "----$product_name----".md5(time());
    
    # -=-=-=- MAIL HEADERS
    
    $to = "$otherEmail";
    $subject = "$product_name - Invitation ";
    
    $headers = "From: $product_name <$product_supportEmail>\n";
    $headers .= "Reply-To: $product_name <$product_supportEmail>\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
    
    # -=-=-=- TEXT EMAIL PART
    
    $message = "--$mime_boundary\n";
    $message .= "Content-Type: text/plain; charset=UTF-8\n";
    $message .= "Content-Transfer-Encoding: 8bit\n\n";
    
    $message .= "Dear $otherName:\n\n";
    $message .= "Your friend $name invited you to join him(her) the $product_name community.";
    $message .= "Please join us at $product_site. \n\n";    
    $message .= "Thank You,\n\n";
    $message .= "$product_name Team\n\n";
    $message .= "$product_supportEmail\n\n";
    
    # -=-=-=- HTML EMAIL PART
     
    $message .= "--$mime_boundary\n";
    $message .= "Content-Type: text/html; charset=UTF-8\n";
    $message .= "Content-Transfer-Encoding: 8bit\n\n";
    
    $message .= "<html>\n";
    $message .= "<body style=\"font-family:Verdana, Verdana, Geneva, sans-serif; font-size:14px; color:#666666;\">\n";
    $message .= "Dear $otherName:<br>\n";
    $message .= "<br>\n";
    $message .= "Your friend $name invited you to join him(her) in the $product_name community.<br>\n";
    $message .= "Please join us at <a href='$product_site'>$product_name</a>.<br>\n<br>\n";    
    $message .= "<br>\n";
    $message .= "Thank you,<br>\n";
    $message .= "$product_name Team<br>\n";
    $message .= "$product_supportEmail<br>\n";
    $message .= "</body>\n";
    $message .= "</html>\n";
    
    # -=-=-=- FINAL BOUNDARY
    
    $message .= "--$mime_boundary--\n\n";
    
    # -=-=-=- SEND MAIL
    
    $mail_sent = @mail( $to, $subject, $message, $headers );
}
?>
